/***
 * Sentence class : used for representing the text exchanged between users
 * during a chat application
 * Contact: 
 *
 * Authors: 
 */

package irc;

import java.io.Serializable;

import jvn.client.JvnException;
import jvn.client.annotation.ReadAndWrite;
import jvn.client.annotation.ReadOnly;
import jvn.client.annotation.SharedObject;

@SharedObject("irc")
public class Sentence extends java.lang.Object implements SentenceI, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	String data;

	public Sentence() throws JvnException{
		data = new String("");
	}
	
	
	public Sentence(String initial, int repetition) throws JvnException{
		super();
		for (int i = 0; i < repetition; i++) {
			data+=initial;
		}
	}

	
	// @Access(mode = ModeEnum.ReadAndWrite)
	/* (non-Javadoc)
	 * @see irc.SentenceI#write(java.lang.String)
	 */
	@Override
	@ReadAndWrite
	public void write(String text) throws JvnException {
		data = text;
	}

	// @Access(mode = ModeEnum.ReadOnly)
	/* (non-Javadoc)
	 * @see irc.SentenceI#read()
	 */
	@Override
	@ReadOnly
	public String read() throws JvnException {
		return data;
	}
	
	@ReadOnly
	public String read2() throws JvnException {
		return data;
	}

}